<html xmlns="http://www.w3.org/1999/xhtml">
    <script type="text/javascript">
    function runTest()
    {
        if (window.testRunner)
            testRunner.dumpAsText();

        test = document.getElementById("test");
        test2 = document.getElementById("test2");
        inp = document.createElement("input");
                                        
        document.body.offsetTop;
        test.appendChild(inp);
        test2.appendChild(inp);     
        document.body.offsetTop;
    }
    </script>
    <body onload="runTest()">
        Test passes if it does not crash.
        <caption>Text in caption 1</caption>
        <caption id="test">
            <a>Text in caption 2</a>
        </caption>
        <caption>
            <div id="test2">
                <a>Text in caption 3</a>
            </div>
        </caption>
    </body>
</html>
